package tsinghua.smxq.foodprice;


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class HttpConnection 
{

	//连接服务器，传递给服务器参数，并获得返回值
	public static String httpConnection(URL url1) throws IOException
	{		
		String result="";
		HttpURLConnection http=(HttpURLConnection)url1.openConnection();	
		InputStreamReader in = new InputStreamReader(http.getInputStream());   
		 BufferedReader buffer = new BufferedReader(in);   
         String inputLine = null;
         while (((inputLine = buffer.readLine()) != null))   
         {                
             result+= inputLine;   
         }    
		
		return result;
	}
}
